package com.itlong.cloud.property.resource;

import com.itlong.cloud.POJO.DTO.property.PropertyCloudServiceCastMessagePageDTO;
import com.itlong.cloud.POJO.VO.property.PropertyCloudServiceCostMessageVO;
import com.itlong.cloud.project.property.IPropertyCloudServiceCostMessageServiceClient;
import com.itlong.cloud.property.service.IPropertyCloudServiceMessageCostService;
import com.itlong.cloud.utils.page.PageByVisitor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


/**
 * <desc>
 *    物业—云服务费消息通知暴露接口实现类.
 * </desc>
 *
 * @createDate 2018-08-09
 */
@RestController
public class PropertyCloudServiceCostMessageServiceResource implements IPropertyCloudServiceCostMessageServiceClient {

    @Autowired
    IPropertyCloudServiceMessageCostService iPropertyCloudServiceMessageCostService;

    /**
     * <desc>
     *      获取云服务费消息推送分页信息。
     * <desc/>
     *
     * @param  pageDTO 请求参数
     * @return
     * @author Juguang.S
     * @createDate 2019-08-07
     */
    @Override
    @RequestMapping(path = "/property/cloudServiceCost/getMessageByPage",method = RequestMethod.POST)
    public PageByVisitor<PropertyCloudServiceCostMessageVO> getMessageByPage(@RequestBody PropertyCloudServiceCastMessagePageDTO pageDTO) throws Exception{
        return iPropertyCloudServiceMessageCostService.getMessageByPage(pageDTO);
    }

    /**
     * <desc>
     *      获取云服务费消息的详细信息。
     * <desc/>
     *
     * @param  messageId 消息ID
     * @param  loginUserId 用户ID
     * @return
     * @author Juguang.S
     * @createDate 2019-08-07
     */
    @Override
    @RequestMapping(path = "/property/cloudServiceCost/getMessageInfo",method = RequestMethod.POST)
    public PropertyCloudServiceCostMessageVO getMessageInfo(@RequestParam("messageId") String messageId,@RequestParam("loginUserId") String loginUserId) {
        return iPropertyCloudServiceMessageCostService.getMessageInfo(messageId,loginUserId);
    }

    /**
     * <desc>
     *      修改云服务费消息的状态。
     * <desc/>
     *
     * @param  messageId 消息ID 多个以逗号隔开
     * @param  type 修改类型 0删除 1修改状态为已读
     * @return
     * @author Juguang.S
     * @createDate 2019-08-07
     */
    @Override
    @RequestMapping(path = "/property/cloudServiceCost/updateMessageInfo",method = RequestMethod.POST)
    public void updateMessageInfo(@RequestParam("messageId") String messageId,@RequestParam("type") String type) {
        iPropertyCloudServiceMessageCostService.updateMessageInfo(messageId,type);
    }

    /**
     * <desc>
     *      保存定时任务的云服务费消息推送。
     * <desc/>
     *
     * @return
     * @author Juguang.S
     * @createDate 2019-08-08
     */
    @Override
    @RequestMapping(path = "/property/cloudServiceCost/savePushMessage",method = RequestMethod.POST)
    public List<Map<String,String>> savePushMessage() throws Exception {
        return iPropertyCloudServiceMessageCostService.savePushMessage();
    }

    /**
     * <desc>
     *      定时向未设置批次号的云对讲设备推送设备过期时间。
     * <desc/>
     *
     * @return
     * @author Juguang.S
     * @createDate 2020-02-27
     */
    @Override
    @RequestMapping(path = "/property/cloudServiceCost/pushCloudTalk",method = RequestMethod.POST)
    public void pushCloudTalk() throws Exception{
        iPropertyCloudServiceMessageCostService.pushCloudTalk();
    }

}
